package cn.iocoder.yudao.module.project.dal.mysql.workstation;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.project.dal.dataobject.workstation.WorkstationDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.project.controller.admin.workstation.vo.*;

/**
 * 工位 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface WorkstationMapper extends BaseMapperX<WorkstationDO> {

    default PageResult<WorkstationDO> selectPage(WorkstationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WorkstationDO>()
                .eqIfPresent(WorkstationDO::getWorkstationIndex, reqVO.getWorkstationIndex())
                .likeIfPresent(WorkstationDO::getWorkstationName, reqVO.getWorkstationName())
                .eqIfPresent(WorkstationDO::getDepartment, reqVO.getDepartment())
                .eqIfPresent(WorkstationDO::getProcessOrder, reqVO.getProcessOrder())
                .eqIfPresent(WorkstationDO::getBusiness, reqVO.getBusiness())
                .eqIfPresent(WorkstationDO::getIsControl, reqVO.getIsControl())
                .eqIfPresent(WorkstationDO::getRemark, reqVO.getRemark())
                .eqIfPresent(WorkstationDO::getElectronicScaleId, reqVO.getElectronicScaleId())
                .betweenIfPresent(WorkstationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WorkstationDO::getId));
    }

}